package com.esc.service;

import com.esc.mapper.ShouyeMapper;
import com.esc.model.Shouye;
import com.esc.server.ShouyeServiceApi;
import com.esc.util.PageResult;
import com.esc.util.PageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class ShouyeServiceImpl implements ShouyeServiceApi {

    @Autowired
    private ShouyeMapper shouyeMapper;

    @Override
    public PageResult queryShouyeList(PageUtil<Shouye> pageUtil) {
        PageResult page = new PageResult();
        int total = shouyeMapper.queryCount();
        page.setTotal(total);
        List<Shouye> list = shouyeMapper.queryShouyeList(pageUtil.getStartIndex(),pageUtil.getRows());
        page.setRows(list);
        return page;
    }
}
